var cc = {};
$(function(){
	cc.init();
});
	
cc.init = function(){

}


//utls
cc.getDatetime = function(k_){//k_ = [''|'date'|'time'] 
		//получение даты (сегодняшний день) вида DATETIME MySQL 
		//без ключа yyyy-mm-dd hh:mm:ss
		//ключ date только yyyy-mm-dd
		//ключ time только hh:mm:s
		var add0 = function(val_){val_+='';val_.length==1?val_='0'+val_:val_;return val_;}
		var date = new Date();
		var day = add0(date.getDate());
		var month = add0((date.getMonth()+1));
		var year = add0(date.getFullYear());
		var hour = add0(date.getHours());
		var min  = add0(date.getMinutes());
		var sec  = add0(date.getSeconds());
		
		switch(k_){
			case 'date':
				return year+'-'+month+'-'+day;	
			case 'time':
				return hour+':'+min+':'+sec;
			case 'ms':
				return hour+':'+min+':'+sec + '.' + date.getMilliseconds();
			case 'daybegin':
				return year+'-'+month+'-'+day+' 00:00:00';
			case 'dayend':
				return year+'-'+month+'-'+day+' 23:59:59';
			case 'monthbegin':
				return year+'-'+month+'-01';
			default : return year+'-'+month+'-'+day+' '+hour+':'+min+':'+sec;
				
		}
	}